package com.ruoyi.system.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.system.service.IDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/statistics")
public class DataController extends BaseController  {
    @Autowired
    private IDataService dataService;

    @GetMapping("/counts")
    public Map<String, Long> getCounts() {
        Map<String, Long> counts = new HashMap<>();
        counts.put("users", dataService.getUserCount());
        counts.put("bookings", dataService.getHotelBookCount());
        counts.put("hotels", dataService.getHotelCount());
        counts.put("attractions", dataService.getScenicareaCount());
        return counts;
    }
}
